<template>
  <transition name="el-fade-in-linear">
    <div @click="close" v-if="drawer" class="mask_bg_drawer flex-x flex-right">
      <div
        @click.stop
        :style="{
          width: width,
        }"
        class="h-full bg_drawer"
      >
        <div class="content_box w100 h-full">
          <slot></slot>
          <div class="close_icon" @click="close"></div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
export default {
  props: {
    width: {
      type: String,
      default: "60%",
    },
    drawer: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {};
  },
  methods: {
    // 点击抽屉以外的地方
    changeStatusDate() {
      console.log("点击抽屉以外的地方 :>> ", this.drawer);
      // if (!this.drawer) {
      //   this.$emit("close");
      // }
    },
    close() {
      this.$emit("close");
      this.$emit("update:drawer", false);
    },
  },
};
</script>

<style lang='scss' scoped>
.mask_bg_drawer {
  background-color: rgba(0, 0, 0, 0.3);
  width: 100%;
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 99999;
}
.bg_drawer {
  padding: 20px 40px;
  color: #fff;
  background: url(../../../../../assets/images/shebeiIcon/shebei_d_bg.png)
    no-repeat 100%;
  background-size: 100% 100%;
  .content_box {
    position: relative;
    .close_icon {
      position: absolute;
      left: -30px;
      top: 46%;
      transform: translate(0, -50%);
      width: 24px;
      height: 114px;
      // background-color: #fff;
      z-index: 2;
      cursor: pointer;
    }
  }
}
</style>